<template>
	<view class="box" v-if="is_loading>0">
		<view class="circumference">
		</view>
	</view>
</template>

<script>
	export default {
		name: "zkLoading",
		data() {
			return {};
		},
		computed: {
			is_loading() {
				return this.$store.state.loading
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 100vw;
		height: 100vh;
		position: fixed;
		top: 0;
		left: 0;
		display: flex;
		justify-content: center;
		align-items: center;
		background: rgba(0, 0, 0, 0);
	}

	.circumference {
		position: relative;

		/* 方块 */
		&::after {
			content: '';
			width: 90rpx;
			height: 90rpx;
			background: #1E85DC;
			opacity: 0.85;
			position: absolute;
			top: -45rpx;
			left: -45rpx;
			border-radius: 10rpx;
			animation: animate 1s linear infinite;
		}

		/* 椭圆 */
		&::before {
			content: '';
			width: 140rpx;
			height: 40rpx;
			background: #000;
			opacity: 0.5;
			position: absolute;
			top: 45rpx;
			left: -70rpx;
			border-radius: 50%;
			animation: shadow 1s linear infinite;
		}

	}

	@keyframes animate {
		17% {
			border-bottom-right-radius: 5rpx;
		}

		25% {
			transform: translateY(20rpx) rotate(22.5deg);
		}

		50% {
			transform: translateY(30rpx) scale(1, .9) rotate(45deg);
			border-bottom-right-radius: 40rpx;
		}

		75% {
			transform: translateY(20rpx) rotate(67.5deg);
		}

		100% {
			transform: translateY(0) rotate(90deg);
		}
	}

	@keyframes shadow {

		0%,
		100% {
			transform: scale(1, 1);
		}

		50% {
			transform: scale(1.2, 1);
		}
	}
</style>